<template>
  <div>
    <el-dialog
      title="查看详情"
      :visible.sync="dialogVisible"
      width="50%"
      :before-close="handleClose">
      <el-table :data="gatherDetailInfoList">
        <el-table-column prop="warehouseInfo.warName" label="仓库名"></el-table-column>
        <el-table-column prop="supplierSupplyOfGoods.shop.shopName" label="商品名"></el-table-column>
        <el-table-column prop="shopNum" label="入库商品数量"></el-table-column>
      </el-table>
      <div>
        <!-- 分页 -->
        <el-pagination
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          :current-page="pageno"
          :page-sizes="[5, 10, 15, 20]"
          :page-size="pagesize"
          layout="total, sizes, prev, pager, next, jumper"
          :total="total"
        >
        </el-pagination>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button type="primary" @click="handleClose">关闭</el-button>
        </span>
    </el-dialog>
  </div>
</template>

<script>
    export default {
        name: "gatherDetailInfo_dialog",
        data(){
          return {
            id:null,
            dialogVisible: false,
            gatherDetailInfoList: [],
            pageno: 1,
            pagesize: 5,
            total: 1,
          }
        },
      methods: {
        getData(id) {
          //检查是否传来参数
          if(id!=undefined){
            this.id=id;
            this.gatherDetailInfoList=[];
            let params = new URLSearchParams();
            params.append("pageno",this.pageno);
            params.append("pagesize",this.pagesize);
            params.append("gatherId",id);//设置父id
            this.$axios.get("gatherDetailInfo/queryAll.action", {params: params})
              .then(res => {
                this.gatherDetailInfoList=res.data.records;
                this.total = res.data.total;
              })
              .catch(err => {
                this.$message.error(err)
              })
          }
        },
        handleSizeChange(val) {
          //每页范围
          this.pagesize = val;
          this.getData(this.id);
        },
        handleCurrentChange(val) {
          //当前页
          this.pageno = val;
          this.getData(this.id);
        },
        handleClose() {
          //关闭
          this.dialogVisible=false;
          this.purchaseDetails=[];
        },
      },
      created() {
        this.getData();
      }
    }
</script>

<style scoped>

</style>
